import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

let routes = [

    {
        path: "/",
        name: "Login",
        component: () => import("../views/user/Login.vue"),
        meta:{
            title:'login'
        }
    },
    {
        path: "/logout",
        name: "Logout",
        component: () => import("../views/user/Login.vue"),
        meta:{
            title:'login'
        }
    },
    {
        path: "/ChangeLog",

        name: "ChangeLog",
        component: () =>
            import("../views/ChangeLog"),
        meta: {
            title:'更新日志',
        }
    },
    {
        path: "/404",
        name: "404",
        component: () => import("../views/404")
    },
]

const router = new VueRouter({
    mode: 'history', // 更改mode，url 会有问题
    base: process.env.BASE_URL,
    routes
})


//生成一个新的router对象，在重新登录时，覆盖旧的的router，防止路由信息重复
let resetRouter = () => new VueRouter({
    mode: 'history', // 更改mode，url 会有问题
    base: process.env.BASE_URL,
    routes
})

export {resetRouter}

export default router

